import { Router } from 'express';
import { ClientPerformanceController } from '../../api/controllers/performanceController';
import { authenticateClient } from '../../middleware/auth';

const router = Router();
const performanceController = new ClientPerformanceController();

/**
 * @swagger
 * /api/client/performances:
 *   get:
 *     summary: 获取演出列表
 *     tags: [客户端演出]
 *     parameters:
 *       - in: query
 *         name: page
 *         schema:
 *           type: integer
 *         description: 页码
 *       - in: query
 *         name: limit
 *         schema:
 *           type: integer
 *         description: 每页数量
 *       - in: query
 *         name: date
 *         schema:
 *           type: string
 *           format: date
 *         description: 演出日期 (YYYY-MM-DD)
 *       - in: query
 *         name: venue
 *         schema:
 *           type: string
 *         description: 演出场地
 *       - in: query
 *         name: status
 *         schema:
 *           type: string
 *         description: 演出状态
 *     responses:
 *       200:
 *         description: 获取成功
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 code:
 *                   type: integer
 *                   example: 200
 *                 message:
 *                   type: string
 *                   example: 获取演出列表成功
 *                 data:
 *                   type: object
 *                   properties:
 *                     items:
 *                       type: array
 *                       description: 演出列表
 *                       items:
 *                         type: object
 *                         properties:
 *                           id:
 *                             type: integer
 *                             description: 演出ID
 *                           title:
 *                             type: string
 *                             description: 演出标题
 *                           description:
 *                             type: string
 *                             description: 演出描述
 *                           venue:
 *                             type: string
 *                             description: 演出场地
 *                           floor:
 *                             type: string
 *                             description: 楼层
 *                           startTime:
 *                             type: string
 *                             format: date-time
 *                             description: 开始时间
 *                           endTime:
 *                             type: string
 *                             format: date-time
 *                             description: 结束时间
 *                           status:
 *                             type: string
 *                             description: 演出状态
 *                           artist:
 *                             type: object
 *                             properties:
 *                               id:
 *                                 type: integer
 *                                 description: 艺人ID
 *                               name:
 *                                 type: string
 *                                 description: 艺人姓名
 *                               avatar:
 *                                 type: string
 *                                 description: 艺人头像URL
 *                     pagination:
 *                       type: object
 *                       properties:
 *                         total:
 *                           type: integer
 *                           description: 总数量
 *                         page:
 *                           type: integer
 *                           description: 当前页码
 *                         limit:
 *                           type: integer
 *                           description: 每页数量
 *                         totalPages:
 *                           type: integer
 *                           description: 总页数
 */
router.get('/',authenticateClient, performanceController.getPerformanceList);

/**
 * @swagger
 * /api/client/performances/{id}:
 *   get:
 *     summary: 获取演出详情
 *     tags: [客户端演出]
 *     parameters:
 *       - in: path
 *         name: id
 *         required: true
 *         schema:
 *           type: integer
 *         description: 演出ID
 *     responses:
 *       200:
 *         description: 获取成功
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 code:
 *                   type: integer
 *                   example: 200
 *                 message:
 *                   type: string
 *                   example: 获取演出详情成功
 *                 data:
 *                   type: object
 *                   properties:
 *                     id:
 *                       type: integer
 *                       description: 演出ID
 *                     title:
 *                       type: string
 *                       description: 演出标题
 *                     description:
 *                       type: string
 *                       description: 演出描述
 *                     venue:
 *                       type: string
 *                       description: 演出场地
 *                     floor:
 *                       type: string
 *                       description: 楼层
 *                     startTime:
 *                       type: string
 *                       format: date-time
 *                       description: 开始时间
 *                     endTime:
 *                       type: string
 *                       format: date-time
 *                       description: 结束时间
 *                     status:
 *                       type: string
 *                       description: 演出状态
 *                     maxCapacity:
 *                       type: integer
 *                       description: 最大容量
 *                     currentAttendance:
 *                       type: integer
 *                       description: 当前参与人数
 *                     artist:
 *                       type: object
 *                       properties:
 *                         id:
 *                           type: integer
 *                           description: 艺人ID
 *                         name:
 *                           type: string
 *                           description: 艺人姓名
 *                         avatar:
 *                           type: string
 *                           description: 艺人头像URL
 *                         description:
 *                           type: string
 *                           description: 艺人描述
 *                         genre:
 *                           type: string
 *                           description: 艺人流派
 *                         bannerImage:
 *                           type: string
 *                           description: 艺人横幅图片URL
 *                         country:
 *                           type: string
 *                           description: 艺人国家
 *                         works:
 *                           type: array
 *                           description: 代表作品列表
 *                           items:
 *                             type: object
 *                             properties:
 *                               id:
 *                                 type: integer
 *                                 description: 作品ID
 *                               title:
 *                                 type: string
 *                                 description: 作品标题
 *                               duration:
 *                                 type: string
 *                                 description: 作品时长
 *                               description:
 *                                 type: string
 *                                 description: 作品描述
 *                               releaseDate:
 *                                 type: string
 *                                 format: date
 *                                 description: 发布日期
 *                               isRepresentative:
 *                                 type: boolean
 *                                 description: 是否为代表作
 *                               audioUrl:
 *                                 type: string
 *                                 description: 音频文件URL
 *                                 nullable: true
 *       404:
 *         description: 演出不存在
 */
router.get('/:id', authenticateClient, performanceController.getPerformanceDetail);

/**
 * @swagger
 * /api/client/performances/{id}/countdown:
 *   get:
 *     summary: 获取演出倒计时
 *     tags: [客户端演出]
 *     parameters:
 *       - in: path
 *         name: id
 *         required: true
 *         schema:
 *           type: integer
 *         description: 演出ID
 *     responses:
 *       200:
 *         description: 获取成功
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 code:
 *                   type: integer
 *                   example: 200
 *                 message:
 *                   type: string
 *                   example: 获取演出倒计时成功
 *                 data:
 *                   type: object
 *                   properties:
 *                     performanceId:
 *                       type: integer
 *                       description: 演出ID
 *                     performanceTitle:
 *                       type: string
 *                       description: 演出标题
 *                     countdown:
 *                       type: object
 *                       properties:
 *                         status:
 *                           type: string
 *                           description: 倒计时状态
 *                           enum: [SCHEDULED, ONGOING, COMPLETED, CANCELLED]
 *                         message:
 *                           type: string
 *                           description: 状态消息
 *                         milliseconds:
 *                           type: integer
 *                           description: 剩余毫秒数
 *                         hours:
 *                           type: integer
 *                           description: 剩余小时数
 *                         minutes:
 *                           type: integer
 *                           description: 剩余分钟数
 *                         seconds:
 *                           type: integer
 *                           description: 剩余秒数
 *       404:
 *         description: 演出不存在
 */
router.get('/:id/countdown', authenticateClient, performanceController.getPerformanceCountdown);

export default router;